﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ComSaleReport.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <%if(Request.QueryString["action"]!="export"){ %>
    <!--#include virtual="include/Head.ascx"-->
    <link rel="stylesheet" href="Assets/css/EditTableCell.css" type="text/css" />
    <script type='text/javascript' src="Assets/js/jquery-custom-1.0.0.js?v=2011"></script>
    <link rel="stylesheet" type="text/css" href="assets/css/datepicker.css" />
    <script type='text/javascript' src="assets/js/jquery.ui.datepicker.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#txtFrom").datepicker({ dateFormat: "dd-mm-yy" });
            $("#txtTo").datepicker({ dateFormat: "dd-mm-yy" });
            $("#btnExport").click(function () {
                openwindowExport();
            });
        });
        function doOpenCosting(ExtID) {
            url = "CostingDetail.aspx?view=0&CustID=0&ExtID=" + ExtID;
            window.open(url, 'CostingDetail', 'width=800,height=600,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
        }
        function openwindowExport() {
            window.open("./ComSaleReport.aspx?action=export", "ComSaleReport", "menubar=0,status=0,directories=0,resizable=1,scrollbars=1,width=720,height=500");
        }
    </script>
    <style type="text/css">
        .bottom td
        {
            font-weight: bold;
            text-align: left;
        }
    </style>
    <%}else{ %>
    <style type="text/css">
        .thheader{
        font-weight:bold;vertical-align:middle;text-align:center;
        font-size:11px;
        border:1px solid #ccc !important;
        line-height: 7px !important;;
        }
        .totalamount{
        font-weight:bold;
        }
    </style>
    <style type="text/css">
        html {
                font-size: 100%;
                height: 100%;
                margin-bottom: 1px; /* Always show a scrollbar to avoid jumping when the scrollbar appears  */
                }

        body {
                font-family: Arial, Helvetica, sans-serif;
                color: #555;
                background: #fff;
                font-size: 12px;
                }
        a        { color: #57a000; text-decoration: none; }
        a:hover     { color: #000; }
        a:active     { color: #777; }
        a:focus     { outline: 1px; }
        table{border-collapse:collaspe;border:1px solid #fff;border-bottom:1px solid #fff;border-right:1px solid #fff;border-left:1px solid #fff;}
        td {border-collapse: collapse;border:1px solid #fff;border-bottom:1px solid #fff;border-right:1px solid #fff;border-left:1px solid #fff;}
        .normal {border-collapse: collapse;border:1px solid #fff;}
        table.adminlist {
            background-color: #fff;
            border-collapse: collapse;
            border-left: 1px solid #CCCCCC;
            border-top: 1px solid #CCCCCC;
            border-right: 1px solid #CCCCCC;
            border-bottom: 1px solid #CCCCCC;
            color: #666666;
            font-size: 12px;
            width: 100%;
        }
        table.adminlist td, table.adminlist th {
            padding: 3px !important;
            background-color: #fff;
        }
        table.adminlist td, table.adminlist th  {
            border-bottom: 1px solid #CCCCCC;
            border-right: 1px solid #CCCCCC;
            border-left: 1px solid #CCCCCC;
        }
        table.adminlist thead, table.adminlist th {
            padding: 3px !important;
            background-color: #ECECEC;
        }
        @media screen, projection{
	span.pseudolink
	{
		color:Blue;
		text-decoration:underline;
		font-size:10pt;
		font-family:Tahoma;
		cursor:hand
	}
	header, footer
	{
		display:none
	}

        @media print{
	        span.pseudolink
	        {
		        display:none
	        }
	        header, footer
	        {
		        display:none
	        }
        }
        .hideifnoscript {
	        display: none
        }
        .wrapword{
        white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
        white-space: -pre-wrap;      /* Opera 4-6 */
        white-space: -o-pre-wrap;    /* Opera 7 */
        white-space: pre-wrap;       /* css-3 */
        word-wrap: break-word;       /* Internet Explorer 5.5+ */
        word-break: break-all;
        white-space: normal;


        }
    </style>
    <%} %>
</head>
<body>
    <div id="body-wrapper">
        <%if(Request.QueryString["action"]!="export"){ %>
        <div id="header">
            <!--#include virtual="include/top.ascx"-->
        </div>
        <%} %>
        <div id="main-content1">
            <h2>
                COM SALE REPORT:
            </h2>
            <div class="clear">
            </div>
            <div class="content-box">
                <form id="frmEdit" runat="server">
                <div class="content-box-header">
                    <%if(Request.QueryString["action"]!="export"){ %>
                    <%if (nPermissions > 7)
                          { %>
                    <h3>
                        User List</h3>
                    <asp:DropDownList class="cls" ID="drAdminUser" runat="server" Width="70px" AutoPostBack="True"
                        OnSelectedIndexChanged="drAdminUser_Selected">
                    </asp:DropDownList>
                    &nbsp;
                    <%} %>
                    Find:
                    <asp:TextBox ID="keyword" Text="" runat="server"></asp:TextBox>
                    By:
                    <asp:DropDownList ID="ddType" runat="server">
                        <asp:ListItem Text="File Number" Value="1"></asp:ListItem>
                        <asp:ListItem Text="Carrier" Value="2"></asp:ListItem>
                        <asp:ListItem Text="Customer" Value="3"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:TextBox ID="txtFrom" CssClass="calendar-icon" runat="server" value="From" onclick="if(this.value=='From'){this.value=''; this.style.color='#000'}"
                        onblur="if(this.value==''){this.value='From'; this.style.color='#555'}" Width="125px"></asp:TextBox>
                    <asp:TextBox ID="txtTo" CssClass="calendar-icon" runat="server" value="To" Width="125px"
                        onclick="if(this.value=='To'){this.value=''; this.style.color='#000'}" onblur="if(this.value==''){this.value='To'; this.style.color='#555'}"></asp:TextBox>
                    <asp:Button ID="btnSearch" Text="Search" runat="server" CssClass="button" Style="margin: 9px 10px;"
                        OnClick="btnSearch_Click" />
                    <%if (nPermissions > 7)
                      { %>
                    <input id="btnExport" type="button" style="float: right; margin: 9px 10px;" class="button"
                        value="&nbsp;Export&nbsp;" />
                    <%} %>
                    <%} %>
                    <div class="clear">
                    </div>
                </div>
                <asp:Repeater ID="rptData" runat="server">
                    <ItemTemplate>
                        <tr onmouseover="this.style.background='#dbf0c9'" onmouseout="this.style.background='#ffffff'"
                            borrowbookid='<%#Eval("ID") %>'>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem, "Index")%>
                            </td>
                            <td editable="false" code="FileNumber" completesource="vFileNumber">
                                <%# DataBinder.Eval(Container.DataItem, "FileNumber")%>
                            </td>
                            <td editable="false" code="Customer">
                                <%# DataBinder.Eval(Container.DataItem, "Customer")%>
                            </td>
                            <td editable="false" code="Agent">
                                <%# DataBinder.Eval(Container.DataItem, "Agent")%>
                            </td>
                            <td editable="false" code="POL">
                                <%# DataBinder.Eval(Container.DataItem, "POL")%>
                            </td>
                            <td editable="false" code="POD">
                                <%# DataBinder.Eval(Container.DataItem, "POD")%>
                            </td>
                            <td editable="false" code="ETD">
                                <%# DataBinder.Eval(Container.DataItem, "ETD")%>
                            </td>
                            <td editable="false" code="Liabilities">
                                <%# DataBinder.Eval(Container.DataItem, "Liabilities")%>
                            </td>
                            <td editable="false" code="Amount">
                                <%# DataBinder.Eval(Container.DataItem, "Amount")%>
                            </td>
                            <td editable="false" code="TypeOfCurrency">
                                <%# DataBinder.Eval(Container.DataItem, "TypeOfCurrency")%>
                            </td>
                            <td editable="false" code="TotalBuyPrice">
                                <%# DataBinder.Eval(Container.DataItem, "TotalBuyPrice")%>
                            </td>
                            <td editable="false" code="TotalSellPrice">
                                <%# DataBinder.Eval(Container.DataItem, "TotalSellPrice")%>
                            </td>
                            <td editable="false" code="GrossProfit">
                                <%# DataBinder.Eval(Container.DataItem, "GrossProfit")%>
                            </td>
                            <td editable="false" code="RateSell">
                                <%# DataBinder.Eval(Container.DataItem, "RateSell")%>
                            </td>
                            <td editable="false" code="RateSell">
                                <%# DataBinder.Eval(Container.DataItem, "Interest")%>
                            </td>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem, "ProfitAfterInterest")%>
                            </td>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem, "Description")%>
                            </td>
                            <%if(Request.QueryString["action"]!="export"){ %>
                            <td>
                                <%# DataBinder.Eval(Container.DataItem, "Action")%>
                            </td>
                            <%} %>
                        </tr>
                    </ItemTemplate>
                    <HeaderTemplate>
                        <table cellspacing="0" cellpadding="0" width="100%" border="0" class="adminlist"
                            editcellcontent="true">
                            <thead>
                                <tr style="background: #ECECEC;">
                                    <th align="center" class="thheader" width="30px">
                                        Index
                                    </th>
                                    <th align="center" class="thheader">
                                        Số file
                                    </th>
                                    <th align="center" class="thheader">
                                        Khách hàng
                                    </th>
                                    <th align="center" class="thheader">
                                        Nhà CC
                                    </th>
                                    <th align="center" class="thheader">
                                        POL
                                    </th>
                                    <th align="center" class="thheader">
                                        POD
                                    </th>
                                    <th align="center" class="thheader">
                                        ATD
                                    </th>
                                    <th align="center" class="thheader">
                                        Công nợ
                                    </th>
                                    <th align="center" class="thheader">
                                        Số lượng
                                    </th>
                                    <th align="center" class="thheader">
                                        Loại tiền
                                    </th>
                                    <th align="center" class="thheader">
                                        Mua vào
                                    </th>
                                    <th align="center" class="thheader">
                                        Bán ra
                                    </th>
                                    <th align="center" class="thheader">
                                        Lợi nhuận gộp
                                    </th>
                                    <th align="center" class="thheader">
                                        Tỷ giá
                                    </th>
                                    <th align="center" class="thheader">
                                        Lãi suất(VND)
                                    </th>
                                    <th align="center" class="thheader">
                                        LN sau lãi suất(VND)
                                    </th>
                                    <th align="center" class="thheader">
                                        Ghi chú
                                    </th>
                                    <%if(Request.QueryString["action"]!="export"){ %>
                                    <th align="center" class="thheader">
                                        Action
                                    </th>
                                    <%} %>
                                </tr>
                            </thead>
                    </HeaderTemplate>
                    <FooterTemplate>
                        <tr class="bottom">
                            <td colspan="10" style="text-align: right; padding-right: 10px !important;">
                                Tổng tiền USD
                            </td>
                            <td>
                                <%=All_TotalBuyPrice_USD.ToString("#,#")%>
                            </td>
                            <td>
                                <%=All_TotalSellPrice_USD.ToString("#,#")%>
                            </td>
                            <td>
                                <%=All_GrossProfit_USD.ToString("#,#")%>
                            </td>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td>
                            </td>
                            <%if(Request.QueryString["action"]!="export"){ %>
                            <td>
                            </td>
                            <%} %>
                        </tr>
                        <tr class="bottom">
                            <td colspan="10" style="text-align: right; padding-right: 10px !important;">
                                Tổng tiền VND
                            </td>
                            <td>
                                <%=All_TotalBuyPrice_VND.ToString("#,#")%>
                            </td>
                            <td>
                                <%=All_TotalSellPrice_VND.ToString("#,#")%>
                            </td>
                            <td>
                                <%=All_GrossProfit_VND.ToString("#,#")%>
                            </td>
                            <td>
                            </td>
                            <td>
                                <%=ALL_Interest.ToString("#,#")%>
                            </td>
                            <td>
                                <%=ALL_ProfitAfterInterest.ToString("#,#")%>
                            </td>
                            <td>
                            </td>
                            <%if(Request.QueryString["action"]!="export"){ %>
                            <td>
                            </td>
                            <%} %>
                        </tr>
                        </TABLE>
                    </FooterTemplate>
                </asp:Repeater>
                <div class="clear">
                </div>
                <div id="footer">
                    <%=strPager%>
                </div>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
